
<!doctype html>
<html class="no-js">
<#include "../../common/header.ftl">
<script	src="${basePath}/js/backImage/edit.js?v=201711021700"></script>
<head>
<meta charset="UTF-8">
<title>编辑背景图</title>
<style>
	.foot{
		position: absolute;
		left: 10%;
		top: 90%;
	}
	.lable_text{
		padding:0px 8px;
	}
	.hide{
		display:none;
	}
	.readonly-input{
		background-color: #e2e2e2;
	}
	.left{
		float:left;
	    width: 45%;
	}
	.answer-tips{
		color:red;
	}
</style>
</head>
<body>
<div style="min-height: 80%; min-width: 90%; margin: 20px 20px;">
		<div style="width:80%;">
			<form class="layui-form layui-form-pane">
				<div class="layui-form-item">
					<label class="layui-form-label" style="width:100%">展示页面：
						<#if image.type==1>首页
						<#else>发现页
						</#if>
					</label>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width:112px;">位置</label>
					<div class="layui-input-block">
						<#if image.type==1 && image.site==1><img src="${basePath}/images/buy1.png" height="40px" width="75px" />
						<#elseif image.type==1 && image.site==2><img src="${basePath}/images/buy2.png" height="40px" width="75px" />
						<#elseif image.type==1 && image.site==3><img src="${basePath}/images/buy3.png" height="40px" width="75px" />
						<#elseif image.type==1 && image.site==4><img src="${basePath}/images/buy4.png" height="40px" width="75px" />
						<#elseif image.type==2 && image.site==1><img src="${basePath}/images/find1.png" height="40px" width="75px" />
						<#elseif image.type==2 && image.site==2><img src="${basePath}/images/find2.png" height="40px" width="75px" />
						<#elseif image.type==2 && image.site==3><img src="${basePath}/images/find3.png" height="40px" width="75px" />
						</#if>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width:112px;">标题*</label>
					<div class="layui-input-block">
						<input type="text"	name="name" required="" lay-verify="required"
							placeholder="请输入标题" value="${image.name!}" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width:112px;">英文标题*</label>
					<div class="layui-input-block">
						<input type="text"	name="englishName" required="" lay-verify="required"
							placeholder="请输入英文标题" value="${image.englishName!}" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width:112px;">图片*</label>
					<div class="layui-input-block">
						<div class="site-upload">
							<#if image.type==2 && image.site==1>
								<img id="image" data-img="${image.image}" src="${imgUrl+image.image}" style="width:175px;height:190px;" >
							<#else>
								<img id="image" data-img="${image.image}" src="${imgUrl+image.image}" style="width:175px;height:90px;" >
							</#if>
							<div class="site-upbar">
								<div class="layui-box">
									<form target="layui-upload-iframe" method="get" key="set-mine" enctype="multipart/form-data" action="#">
										 <input type="file" name="files" data-type="one" class="layui-upload-file" >
									</form>
								</div>
								<#if image.type==2 && image.site==1>
									<p class="am-form-help">图片尺寸： 宽&nbsp;&nbsp;175PX 高&nbsp;&nbsp;190PX</p>
								<#else>
									<p class="am-form-help">图片尺寸： 宽&nbsp;&nbsp;175PX 高&nbsp;&nbsp;90PX</p>
								</#if>
							</div>
						</div>
					</div>
				</div>
			</form>
			</div>
	<div class="foot">
		<button type="button" class="layui-btn layui-btn-normal"
			id="save-button">
			<i class="layui-icon">&#xe605;</i>保存
		</button>
		<button type="button" class="layui-btn layui-btn-normal"
			id="close-button">
			<i class="layui-icon">&#x1006;</i>关闭
		</button>
	</div>
</div>
</body>
<script type="text/javascript">
	var basePath = "${basePath}";
	var imgUrl = "${imgUrl}";
	var init={
	 	imageId:"${image.id!}",
	 	type:"${image.type!}",
	 	site:"${image.site!}",
	}
	layui.use(['form','layer','upload'], function() {
		var form = layui.form();
		var layer = layui.layer;
		layui.upload({
    		url: basePath+'/restful/file/upload.shtml', //上传接口
    		ext: 'jpg|png|bmp|jpeg',
    		method: 'post',
    		success: function(res,input){ //上传成功后的回调
    			console.log(res);
			    if(res.code=="000000"){
				 	var id=res.data[0].id;
				    var src=imgUrl+id;
				    $("#image").attr("src",src);
				    $("#image").attr("data-img",id);
			    }else{
			      layer.msg("上传失败")
			    }
			}
  		});
	});
</script>
</html>
